package com.newcapec.news.servlet;

import com.newcapec.news.dao.SysUserDao;
import com.newcapec.news.dao.impl.SysUserDaoImpl;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Description: 删除用户信息
 * @Author: fujun
 * @Date : 2022/3/17 16:17
 * @Version : 1.0
 * @company 新开普电子股份有限公司
 */
public class DelSysUserServlet  extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        req.setCharacterEncoding("utf-8");
//        resp.setCharacterEncoding("utf-8");


        String uid=req.getParameter("uid");

        SysUserDao sysUserDao=new SysUserDaoImpl();
        if(uid!=null){

        sysUserDao.delUser(Integer.parseInt(uid));

        resp.sendRedirect("page/AccountManagement.html");


        }else{
            resp.sendRedirect("page/AccountManagement.html");
        }

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req, resp);
    }
}
